package com.hup.sb.view;

import com.hup.sb.model.MainConfig;
import com.hup.utils.swing.customView.ImageButton;
import com.hup.utils.swing.ui.MyWindowsSliderUI;

import javax.swing.BorderFactory;
import javax.swing.ImageIcon;
import javax.swing.JComponent;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JSlider;
import javax.swing.border.TitledBorder;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;

/**
 * @author hugan
 * @date 2022/2/27
 */
public class MainForm {
    public JPanel root;
    public ImageButton btnHide;
    public ImageButton btnExit;
    public JSlider alphaSetter;

    public MainForm() {
        $$$setupUI$$$();
        alphaSetter.setUI(new MyWindowsSliderUI(alphaSetter));
        alphaSetter.setMinimum(MainConfig.MIN_BRIGHTNESS);
    }

    /**
     * Method generated by IntelliJ IDEA GUI Designer
     * >>> IMPORTANT!! <<<
     * DO NOT edit this method OR call it in your code!
     *
     * @noinspection ALL
     */
    private void $$$setupUI$$$() {
        root = new JPanel();
        root.setLayout(new GridBagLayout());
        root.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(), null, TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION, null, null));
        alphaSetter = new JSlider();
        alphaSetter.setMinorTickSpacing(10);
        alphaSetter.setOrientation(1);
        alphaSetter.setPaintTicks(true);
        alphaSetter.setValue(50);
        GridBagConstraints gbc;
        gbc = new GridBagConstraints();
        gbc.gridx = 0;
        gbc.gridy = 2;
        gbc.gridwidth = 2;
        gbc.weighty = 1.0;
        gbc.fill = GridBagConstraints.BOTH;
        root.add(alphaSetter, gbc);
        final JLabel label1 = new JLabel();
        label1.setText("亮度");
        gbc = new GridBagConstraints();
        gbc.gridx = 0;
        gbc.gridy = 1;
        gbc.gridwidth = 2;
        gbc.fill = GridBagConstraints.VERTICAL;
        root.add(label1, gbc);
        btnHide = new ImageButton();
        btnHide.setIcon(new ImageIcon(getClass().getResource("/img/icon_hide.png")));
        gbc = new GridBagConstraints();
        gbc.gridx = 0;
        gbc.gridy = 0;
        root.add(btnHide, gbc);
        btnExit = new ImageButton();
        btnExit.setIcon(new ImageIcon(getClass().getResource("/img/icon_exit.png")));
        gbc = new GridBagConstraints();
        gbc.gridx = 1;
        gbc.gridy = 0;
        root.add(btnExit, gbc);
    }

    /**
     * @noinspection ALL
     */
    public JComponent $$$getRootComponent$$$() {
        return root;
    }

}
